package com.cg.controller;

import com.cg.Dto.InsertDictionDto;
import com.cg.Dto.SearchDictionaryDto;
import com.cg.Dto.UpdateDictinDto;
import com.cg.result.R;
import com.cg.service.DictionarydataService;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lhy
 * @since 2024-12-26
 */
@RestController
public class DictionarydataController {
    @Resource
    private DictionarydataService dictionarydataService;
    @GetMapping("/searchByDicId")
    @Schema(description = "联合查询接口")
    public R<?> search(@ModelAttribute @Valid SearchDictionaryDto searchDictionaryDto)
    {
        return  dictionarydataService.search(searchDictionaryDto);
    }
    @PostMapping("/insertDictionaryDate")
    @Schema(description = "新增数据字典值接口")
    public R<?> insert(@RequestBody @Valid InsertDictionDto insertDictionDto)
    {
        return dictionarydataService.insert(insertDictionDto);
    }
    @PutMapping("/updateStatus")
    @Schema(description = "修改数据字典值状态")
    public R<?>update(@RequestBody @Valid UpdateDictinDto updateDictinDto)
    {
        return  dictionarydataService.updates(updateDictinDto);
    }
}

